package com.kgc.scd.controller;

import com.kgc.scd.bean.ShopSignInDay;
import com.kgc.scd.service.SignInService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created On : 2022/11/17.
 * <p>
 * Author : yantao
 * <p>
 * Description: SignInServerService
 */
@Slf4j
@RestController
@RequestMapping("/ytserver")
public class SignInServerService {
    @Autowired
    private SignInService signInService;

    /**
     * @author : yantao
     * @date   : 2022/11/17
     * @param  : [userId]
     * @return : void
     * @description : 添加大积分4个
     */
    @GetMapping("addSmallPointsToUsers")
    public void addSmallPointsToUsers(@RequestParam String userId){
        signInService.addSmallIntegral(userId);
    }


    /**
     * @author : yantao
     * @date   : 2022/11/17
     * @param  : [userId]
     * @return : void
     * @description : 添加小积分 2个
     */
    @GetMapping("addLargePointsToUsers")
    public void addLargePointsToUsers(@RequestParam String userId){
        signInService.addLargeIntegral(userId);
    }



    @GetMapping("/insertDaySignIn")
    public void insertDaySignIn(@RequestParam String userId){
        signInService.recordTime(userId);
    }

    @GetMapping("/selectDayAll")
    public List<ShopSignInDay> selectDayAll(@RequestParam String userId){



        return signInService.selectDays(userId);
    }



}
